package com.kaifamiao.ajax.utils;

import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.writer.ObjectWriter;

import java.lang.reflect.Type;

public class LongToStringSerializer implements ObjectWriter<Long> {

    @Override
    public void write(JSONWriter w, Object src, Object name, Type srcType, long value) {
        if( src == null ) {
            w.writeNull();
        } else {
            w.writeString( src.toString() );
        }
    }

}
